
from concurrent.futures import ThreadPoolExecutor
import sys
import os
import time

sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))

from spider.airun_park import AirunParkSpider
from common.logger import logger
from model.car_number import CarNumber

def get_proxy():
    return None

def test():
    try:
        spider = AirunParkSpider()
        spider.setAccount("95ca9ad7c2eebf22a09579d8f82a37a975bfb033")
        while True:
            # spider.setProxy(get_proxy())
            r = spider.query(CarNumber("陕B11111"))
            logger.success(f"{r.enter_time}: {r.park_name}")
    except Exception as e:
        logger.exception(e)

if __name__ == "__main__":
    thread_count = 1
    thread_pool = ThreadPoolExecutor(max_workers=thread_count)
    futures = []
    for i in range(thread_count):
        futures.append(thread_pool.submit(test))

    thread_pool.shutdown(wait=True)